package by.home.app;

import java.io.*;


public class App
{
    public static void main( String[] args ) throws IOException, ClassNotFoundException
    {
        ObjectOutputStream oos= new ObjectOutputStream(new FileOutputStream("tree.xml"));
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("tree.xml"));
        UserData usr1 = new UserData("name1","pass1",1);
        UserData usr2 = new UserData("name2","pass2",2);
        UserData usr3 = new UserData("name3","pass3",3);
        Tree bTree = new Tree(usr1);
        bTree.addNode(usr2);
        bTree.addNode(usr3);
        oos.writeObject(bTree);
        oos.flush();
        oos.close();
        Tree bTreeIn =(Tree) ois.readObject();
        ois.close();
        System.out.println(bTreeIn);
    }
}
